package Employee1;

class SalariedEmployee extends Employee{
    private double monthSalary; 		   //封装monthSalary属性
    public SalariedEmployee(){}   		   //无参构造方法
    //有参构造方法   参数  姓名 生日月份  月薪
    public SalariedEmployee(String name,int month,double monthSalary){
        super(name,month);                  //调用父类有参构造方法
        this.monthSalary = monthSalary;   //为属性monthSalary初始化赋值
    }
    //获取monthSalary的值
    public double getMonthSalary(){
        return monthSalary;
    }
    //给monthSalary赋值
    public void setMonthSalary(double monthSalary){
        this.monthSalary = monthSalary;
    }
    //覆盖父类中的方法
    public double getSalary(int month){
        //定义工资变量
        double salary = monthSalary+super.getSalary(month);
        return salary;
    }
}